<!DOCTYPE html>
<html lang="en" xmlns:zxw="http://www.w3school.com.cn" xmlns:njzxw="http://www.w3.org/1999/html">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>首页</title>
    <link rel="stylesheet" href="../../js/common/layui/css/layui.css">
    <link rel="stylesheet" href="../../css/common/animate.css" />
    <link rel="stylesheet" href="../../css/common/common.css" />
    <style type="text/css">
        .layui-upload-drag img {
            width: 100px;
            height: 100px;
        }

        .layui-field-title {
            border-width: 1px;
            padding: 10px;
            border-radius: 5px;
        }
    </style>
</head>
<body class="layout-zxw layout-zxw-add" >
    <form action="" id="teacherAttrform" class="layui-form layui-fluid" lay-filter="teacherAttrfilter">
        <fieldset class="layui-elem-field layui-field-title">
            <legend>基本信息</legend>
            <div class="layui-row layui-center">
                <div class="layui-upload-drag" id="upload">
                    <img src="../../../img/headDefout.jpg">
                    <input type="hidden" id="headimg" name="headimg" value="">
                    <input type="hidden" id="headid" name="headid" value="">
                    <p>点击上传图像，或将文件拖拽到此处</p>
                </div>
            </div>
            <div class="layui-row">
                <zxw:input id="name" type="text" parcel="true" parcelName="姓名" parcelclass="col-xs-6"
                           inline="true" value="" maxlength="10" name="name" lay_verify="required" class=""></zxw:input>
                <zxw:input id="mobile" name="mobile" maxlength="11" parcel="true" parcelName="号码" inline="true"
                           parcelclass="col-xs-6" lay_verify="phone"></zxw:input>
            </div>
            <div class="layui-row">
                <zxw:input id="email" type="text" name="email" lay_verify="email" inline="true"
                           parcelclass="col-xs-6" parcel="true" parcelName="email"></zxw:input>
                <zxw:input id="bir" name="bir" type="date" lay_verify="date" inline="true" parcelclass="col-xs-6"
                           parcel="true" parcelName="生日"></zxw:input>
            </div>
            <zxw:textarea id="addr" name="addr" placeholder="请输入内容" parcel="true" parcelName="地址"></zxw:textarea>
        </fieldset>

        <!--<div class="layui-row">-->
            <!--<zxw:input id="manage_name" type="text" parcel="true" placeholder="请输入老师名称" parcelName="老师名称" parcelclass="col-xs-12" inline="false" value="" maxlength="50" name="manage_name"-->
                       <!--lay_verify="required" class="" ></zxw:input>-->
        <!--</div>-->

        <!--<div class="layui-row">-->
            <!--<zxw:input id="manage_id" type="text" parcel="true" placeholder="请输入老师id" parcelName="老师id" parcelclass="col-xs-12" inline="false" value="" maxlength="50" name="manage_id" lay_verify="required" class="" ></zxw:input>-->
        <!--</div>-->
        <div class="layui-row" style="display: flex">
            <zxw:radio id="support_ptrainer" fun="tearcherAttr.supportPtrainer" parcel="true" checked="1" field_value_key="values" field_name_key="name" isItem="true" url="YESORNO" lay_verify="required"
                       parcelName="支持私教"
                       parcelclass="col-xs-4"
                       inline="true"></zxw:radio>

            <div id="ptrainerDiv" style="display: none">
                <zxw:radio id="ptrainer_scheduling" fun="tearcherAttr.classType" parcel="true" field_value_key="values" field_name_key="name" isItem="true" url="YESORNO" lay_verify="required"
                           parcelName="支持私教排课"
                           parcelclass="col-xs-4"
                           inline="true"></zxw:radio>
            </div>
            <div id="ClassTypeDiv" style="display: none;">
                <zxw:radio id="class_type" fun="" parcel="true" field_value_key="values" field_name_key="name" isItem="true" url="SCHEDULE.CLASS.TYPE" lay_verify="required" parcelName="排课类型"
                           parcelclass="col-xs-4"
                           inline="true"></zxw:radio>
            </div>
        </div>
        <div class="layui-row">
            <zxw:radio id="see_tel" fun="" parcel="true" checked="0" field_value_key="values" field_name_key="name" isItem="true" url="YESORNO" lay_verify="required" parcelName="查看会员电话"
                       parcelclass="col-xs-12"
                       inline="false"></zxw:radio>
        </div>
        <div class="layui-row" style="display: flex">
            <zxw:radio id="limit_classes" fun="tearcherAttr.showclassesDiv" parcel="true" checked="0" field_value_key="values" field_name_key="name" isItem="true" url="YESORNO" lay_verify="required" parcelName="限制每天私教课数"
                       parcelclass="col-xs-6"
                       inline="true"></zxw:radio>
            <div id="classesDiv">
                <zxw:input id="classes" type="text" parcel="true" placeholder="请输入不限制每天最多可私教课" parcelName="每天最多上私教课" parcelclass="col-xs-6" inline="true" value="" maxlength="50" name="classes"
                           lay_verify="" class="" ></zxw:input>
            </div>
        </div>
        <div class="layui-row">
            <zxw:input id="league_fee" type="text" parcel="true" placeholder="请输入团课费用" parcelName="团课费用" parcelclass="col-xs-12" inline="false" value="" maxlength="50" name="league_fee" lay_verify="required" class="" ></zxw:input>
        </div>
        <div class="layui-row" style="display: flex">
            <zxw:radio id="limit_attend_classes" fun="tearcherAttr.limitClasses" parcel="true" checked="1" field_value_key="values" field_name_key="name" isItem="true" url="YESORNO" lay_verify="required"
                       remark="限制老师每天可排私教课节数" parcelName="限制私教排课"
                       parcelclass="col-xs-6"
                       inline="true"></zxw:radio>
            <div class="layui-row" id="limitClassDiv">
                <zxw:input id="attend_classes" type="text" parcel="true" placeholder="请输入不限制每天最多可排私教课" parcelName="每天最多排私教课" parcelclass="col-xs-6" inline="true" value="" maxlength="5"
                           name="attend_classes" lay_verify="" class="" ></zxw:input>
            </div>
        </div>
        <div class="layui-row">
            <zxw:textarea id="teacher_info" type="text" parcel="true" placeholder="请输入详细介绍" parcelName="详细介绍" parcelclass="col-xs-12" inline="false" value="" maxlength="50" name="teacher_info"
            lay_verify="" class="" ></zxw:textarea>
        </div>
        <div class="layui-row">
            <zxw:input id="price" type="number" parcel="true" placeholder="请输入底薪" parcelName="底薪" parcelclass="col-xs-12" inline="false" value="" maxlength="50" name="price" lay_verify="required"
                       class="" ></zxw:input>
        </div>
        <!--<div class="layui-row">-->
            <!--<zxw:shop id="merchant_id" type="checkbox" parcel="true" placeholder="请输入商户id" parcelName="商户id" parcelclass="col-xs-12" inline="false" value="" maxlength="50" name="merchant_id"-->
                  <!--lay_verify="required" class="" ></zxw>-->
        <!--</div>-->
        <div class="layui-row">
            <!--<input type="text" value="1" name="shop_id" id="shop_id">-->
            <!--<input type="text" value="1" name="merchant_id" id="merchant_id">-->
            <!--<input type="text" value="1" name="manage_id" id="manage_id">-->

            <zxw:shop type="checkbox" placeholder="商铺信息" parcel="true" parcelName="商铺信息" lay_verify="required"></zxw:shop>
        </div>
        <div class="layui-row">
            <zxw:input id="private_classes" type="text" parcel="true" placeholder="请输入私教课授课百分比" parcelName="私教课授课百分比" parcelclass="col-xs-12" inline="false" value="" maxlength="50" name="private_classes" lay_verify="" class="" ></zxw:input>
        </div>
    </form>

    <script type="application/javascript" src="../../js/common/own/own.js?layui,jquery,njzxw,URL,myurl,myconfig,tearcherAttr" >
        njzxw.layui.val({
            url:MY_URL.TEACHERATTR.QUERYID,
            fun:function(data){
                //存在初始化需要额外处理的在此操作
            },
            paramExe:function(data) {
                tearcherAttr.supportPtrainer(data.support_ptrainer)
                tearcherAttr.classType(data.ptrainer_scheduling)
                tearcherAttr.showclassesDiv(data.limit_classes)
                tearcherAttr.limitClasses(data.limit_attend_classes)
                return data;
            }
        });
        njzxw.layui.submit({
            url:MY_URL.TEACHERATTR.SAVE,
            prepFun:function (data) {
                // data.xxx = 1;
                if(data.limit_classes == '1') {
                    // alert(Math.ceil(data.classes))
                    if(typeof (data.classes) != 'number' && Math.ceil(data.classes) < 0) {
                        return "每天最多上私教课为整数类型"
                    }
                }

                if(data.limit_attend_classes == '1') {
                    if(typeof (data.attend_classes) != 'number' && Math.ceil(data.attend_classes) < 0) {
                        return "每天最多可排私教课为整数类型"
                    }
                }
                return data;
            }
        });
    </script>
</body>
</html>